<?php 
defined('_JEXEC') or die('Restricted access'); 
//$Itemid = JRequest::getVar( 'Itemid', 0, 'get', 'int' );
//$ordering = ($this->lists['order'] == 'ordering');
JHTML::stylesheet('base.css', JURI::root().'components/com_simplelisting/css/');
JHTML::stylesheet('listing.css', JURI::root().'/components/com_simplelisting/css/themes/'.$this->select_theme.'/');
?>

<div id="listing_details"><!-- Start main container div-->
    <div id="listing_details_inner"><!-- Start inner div -->
        <form action="" method="post" name="adminForm" >
            <div class="header">
               <table class="general_details">
                   <tbody>
                       <tr>
                           <td class="cw_title_main">
                                <?php echo JText::_('FT_SHORTLIST')?>
                           </td>
                       </tr>
                   </tbody>
               </table>
            </div>
    <?php
    $user =& JFactory::getUser();
    if ($user->guest) { ?>
        <div style="width:100%; height:10px;"></div>
        <input type="button" onClick="javascript:window.location='<?php echo JRoute::_( 'index.php?option=com_user&view=login'); ?>'" value="<?php echo JText::_('BT_LOGIN'); ?>" class="button" >
        <div style="width:100%; height:10px;"></div>
    <?php }
    else {

?>
<div style="width:100%; height:10px;"></div>
<table class="cw_listing">
    <thead>
    <tr>
        <th width="5%">#</th>
        <th width="5%"><?php echo JText::_('LABEL_REF') ?></th>
        <th width="30%" ><?php echo JText::_('LABEL_NAME') ?></th>
        <th width="15%"><?php echo JText::_('LABEL_CATEGORY') ?></th>
        <th width="15%"><?php echo JText::_('LABEL_TYPE') ?></th>
        <th width="15%"><?php echo JText::_('LABEL_CONTACT_NAME') ?></th>
        <th width="15%"><?php echo JText::_('LABEL_POSTED_DATE') ?></th>
    </tr>
    </thead>
    <tbody>
    
    <?php
     $user =& JFactory::getUser();

    
        $k = 0;
            for ($i=0, $n=count( $this->items ); $i < $n; $i++)
            {
            $row = &$this->items[$i];
        $link1 = JRoute::_( 'index.php?option='.JRequest::getVar('option').'&task=deleteFav&fid[]='. $row->id );
        $link  = JRoute::_( 'index.php?option=com_simplelisting&task=show&cid[]='.$this->escape($row->pid)); 
        if($user->id == $row->create_by){
       ?>
       <tr class="<?php echo "row$k"; ?>">
       <td><a href="<?php echo JRoute::_( $link1 ) ?>" title="<?php echo JText::_('Delete') ?>"onclick="return confirm('<?php echo JText::_('CONFIRM_DELETE_MSG') ?>')">
       <?php echo JHTML::_('image.site', 'delete.png', '/components/com_simplelisting/images/') ?></a></td>
       <?php
        echo "<td>".$this->escape($row->pid)."</td>";
        echo "<td><a href=".$link.">".$this->escape($row->name)."</a></td>";
        echo "<td>".$this->escape($row->catname)."</td>";
        echo "<td>".$this->escape($row->tidname)."</td>";
        echo "<td>".$this->escape($row->username)."</td>";
        echo "<td>".JHTML::_('date',  $row->entrydate,  JText::_('DATE_FORMAT_LC4') )."</td>";
       }
       ?>
       </tr>
       <?php
		$k = 1 - $k;
        }
    
	?>
       </tbody>
</table>

<input type="hidden" name="view" value="favourite" />
<input type="hidden" name="option" value="<?php echo JRequest::getVar( 'option' );?>"/>

<?php } ?>
            <?php if ( $this->params->get( 'show_poweredby' ) ) : ?>
                <div class="cw_powerbyfront">
                    <span class="cw_powerbyfront"><?php echo JTEXT::_('POWEREDBY_MSG'); ?> <a href="http://www.celtaweb.com" target="_blank" title="CeltaWeb">CeltaWeb</a> </span>
                </div>
            <?php endif ?>
        </form><!-- End listing form -->
    </div><!-- End inner div -->
</div><!-- End main container div -->

